<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>Hot N Cold</title>
    <!---------------- C S S ----------------> 
    <link rel="stylesheet" type="text/css" href="<?php echo $template; ?>css/konkurrence.css">     
    <!---------------- J S    ---------------->  
	<script type="text/javascript" src="<?php echo $template; ?>js/jquery-1.6.4.min.js"></script>
	<script type="text/javascript" src="<?php echo $template; ?>js/jquery-ui-1.8.16.custom.min.js"></script>
	<script type="text/javascript" src="<?php echo $template; ?>js/jquery.inputToggle.js"></script>
	<script type="text/javascript" src="<?php echo $template; ?>js/jquery.validate.js"></script>
	<script type="text/javascript">
		$(document).ready(function($) {
			$('.inputToggle,.fb-txt').inputToggle();
		 });
	</script>
</head>
<body>
	<?php if(!$liked): ?>	
		 <div class="fb-ads">
			<?php echo $description; ?>
		 </div>
	<?php else: ?>		
		<div class="fb-login">
			<div class="share-fb">
				<a href="https://www.facebook.com/sharer/sharer.php?u=https://www.hotcold.dk/" target="_blank">
					<img src="<?php echo HTTP_SERVER; ?><?php echo $template; ?>images/facebook/btn-share-fb.png"/>
				</a>
			</div>
			<div class="logoH"><img src="<?php echo HTTP_SERVER; ?><?php echo $template; ?>images/facebook/logo-big.png" alt=""></div>
			<?php echo $description1; ?>
			 <div class="boxFormLG">
				<form id="f-newsletter">
					<fieldset>
						<input name="name" id="name"  class="fb-txt" type="text" placeholder="Indtast din navn...">
						<input name="email" id="email" class="fb-txt" type="text" placeholder="Indtast din e-mail....">
						<a class="fb-btn-join" href="javascript:void(0)" onclick="jQuery('#f-newsletter').submit()"><img src="<?php echo HTTP_SERVER; ?><?php echo $template; ?>images/facebook/bntDeltag.png"></a>
					</fieldset>
				</form>
			</div>
			<div class="boxPhone">
				<?php echo  $description2; ?>
			</div>
		</div><!-- End fb-login-->
	<?php endif; ?>	
	<!-- js files -->
	<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery.validator.addMethod("notEqual", function(value, element, param) {
			return this.optional(element) || value !== param;
		});
		jQuery("#f-newsletter").validate(
			{
				errorPlacement: function(error, element) {			
			},
			invalidHandler: function(form, validator) {
			  var errors = validator.numberOfInvalids();
			if (errors) {
				alert(validator['errorList'][0]['message']);
				validator['errorList'][0]['element'].focus();
			  } 
			},
			rules: {
				"name":{
					required: true,
					notEqual: "Indtast din navn...",
				},
				
				"email": {
					required: true,
					email: true,
				},
			},
			messages: {
				"name": "Indtast din navn",
				"email": "Indtast din e-mail",
			},
			 submitHandler: function(form) {
				jQuery.ajax({
				type: "POST",
				url: "index.php?route=information/konkurrence/join",			
				data: jQuery('#f-newsletter').serialize() ,
				success: function(data){
					if(data=='Tak for tilmelding vores konkurrence'){jQuery('#f-newsletter')[0].reset();}
					alert(data);
					
				}
			});
			return false;
			}
		});
	});
	</script>  
	<!--/ js files -->   
</body>
</html>